package com.waqu.common.utils.other;

import com.waqu.common.utils.text.StringTools;

public class ArtEcho {

	public static int echoWidth = 80;

	public static String echoFill = ".";

	public static void echo(String s) {
		String spaceStr = "";
		int length = 0;
		for (int i = 0; i < s.length(); i++) {
			length = s.charAt(i) > 255 ? length + 2 : length + 1;
		}
		if (length < echoWidth) {
			spaceStr = StringTools.repeat(echoFill, echoWidth - length);
		}
		Me.print(s);
		Me.print(spaceStr);
	}

	public static void echo(String s, int width, String fill) {
		String spaceStr = "";
		int length = 0;
		for (int i = 0; i < s.length(); i++) {
			length = s.charAt(i) > 255 ? length + 2 : length + 1;
		}
		if (length < width) {
			spaceStr = StringTools.repeat(fill, width - length);
		}
		Me.print(s);
		Me.print(spaceStr);
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		ArtEcho.echo("Hello,world!!!!Hello!");
	}

}